import { useResponseSuccess } from '~/utils/response';

export default eventHandler((event) => {
  const bookingId = getRouterParam(event, 'id');

  // 模拟取号排队
  const queueTicket = {
    id: `ticket_${Date.now()}`,
    ticketNumber: `A${Math.floor(Math.random() * 100)
      .toString()
      .padStart(3, '0')}`,
    bookingId,
    serviceId: '1',
    customerName: '张三',
    phoneNumber: '13800138001',
    position: Math.floor(Math.random() * 20) + 1,
    status: 'waiting', // waiting, serving, completed
    estimatedWaitTime: `${Math.floor(Math.random() * 60) + 10}分钟`,
    serviceWindow: '窗口1',
    createTime: new Date().toISOString(),
    updateTime: new Date().toISOString(),
  };

  return useResponseSuccess(queueTicket);
});
